<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ScrumDashboard._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/ui/WorkItemView.ascx"  TagName="WorkItemView" TagPrefix="UC" %>
<%@ Register Src="~/ui/ProductBacklogView.ascx"  TagName="ProductBacklogView" TagPrefix="UC" %>
<%@ Register Src="~/ui/CreateProductBacklogMenu.ascx"  TagName="CreateProductBacklogMenu" TagPrefix="UC" %>
<%@ Register Src="~/ui/CreateProductBacklogView.ascx"  TagName="CreateProductBacklogView" TagPrefix="UC" %>
<%@ Register Src="~/ui/AddProductBacklogsView.ascx"  TagName="AddProductBacklogsView" TagPrefix="UC" %>
<%@ Register Src="~/ui/ImportBugsView.ascx"  TagName="ImportBugsView" TagPrefix="UC" %>
<%@ Register Src="~/ui/CreateTaskView.ascx"  TagName="CreateTaskView" TagPrefix="UC" %>
<%@ Register Src="~/ui/SprintQuickStats.ascx"  TagName="SprintQuickStats" TagPrefix="UC" %>
<%@ Register src="ui/AssignTo.ascx" tagname="AssignTo" tagprefix="UC" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Scrum Dashboard <%=GetVersion()%></title>
    <script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="scripts/jquery-ui-personalized-1.6rc6.min.js"></script>
    <script type="text/javascript" src="scripts/helpers.js"></script>
    <script type="text/javascript" src="scripts/dragBox.js"></script>
   <link href="styles/style.css" rel="stylesheet" type="text/css" />
   <link rel="alternate" type="application/rss+xml" title="ScrumDashboard Product Backlog Activity" href="rss.ashx" />
</head> 
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager1" runat="server">
         <Services>
              <asp:ServiceReference Path="AjaxService.asmx" />
        </Services>
    </asp:ScriptManager>
            <div style="padding: 10px;float: left;">  
                <asp:UpdatePanel ID="sprintTotalPanel" UpdateMode="Conditional" ChildrenAsTriggers="False" runat="server">
                <ContentTemplate>
                    <img src="images/episerver_scrumdashboard.jpg" />
                    <fieldset>
                    <table>
                        <tr>
                            <td style="width: 60px"><b>Project:</b></td>
                            <td style="width: 200px"><asp:DropDownList Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ProjectChanged" runat="server" ID="project"></asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td><b>Sprint:</b></td>
                            <td><asp:DropDownList Width="100%" runat="server" ID="sprintList"></asp:DropDownList></td>
                        </tr>
                         <tr>
                            <td><b>Team:</b></td>
                            <td><asp:DropDownList Width="100%" runat="server" ID="teamList"></asp:DropDownList></td>
                        </tr>
                         <tr>
                            <td></td>
                            <td align="right"><asp:Button id="viewSprintButton" Text="Load" runat="server" OnClick="ViewSprintClick" /><br /></td>
                        </tr>
                        </table>
                        </fieldset>
                        <fieldset>
                        <table>                         
                        <tr>
                            <td style="width: 60px"><b>Period:</b></td>
                            <td><%# ViewData.Sprint.SprintStart.ToShortDateString()%> - <%# ViewData.Sprint.SprintEnd.ToShortDateString()%></td>
                        </tr>
                        <tr>
                            <td><b>Effort:</b></td>
                            <td><%# ViewData.Statistics.CurrentEffort%> of <%# ViewData.Statistics.EstimatedEffort%> (<%# ViewData.Statistics.CurrentEffortPercent.ToString("n0")%>%)</td>
                        </tr>
                        <tr>
                            <td><b>Work:</b></td>
                            <td><%# ViewData.Statistics.CompletedWork%>h of <%# ViewData.Statistics.WorkTotal%>h (<%# ViewData.Statistics.CompletedWorkPercent.ToString("n0")%>%)</td>
                        </tr>
                        <asp:PlaceHolder Visible=>
                        <tr class="<%#(String.IsNullOrEmpty(ViewData.Sprint.Goal) ? "invisible" : "")%>">
                            <td valign="top"><b>Goal:</b></td>
                            <td><%# RenderGoal() %></td>
                        </tr>
                        </asp:PlaceHolder>
                    </table>
                    </fieldset>    
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="viewSprintButton" />
                    <asp:AsyncPostBackTrigger ControlID="project" />
                </Triggers>
            </asp:UpdatePanel>
            </div>
            <div style="width: 90px; margin-top: 50px; padding-left: 10px;text-align: center;float: left;">
                <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" ChildrenAsTriggers="False" runat="server">
                    <ContentTemplate>
                        <UC:SprintQuickStats ID="SprintQuickStats1" runat="server" />
                    </ContentTemplate>
                    <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="viewSprintButton" />
                        </Triggers>
                   </asp:UpdatePanel>
            </div>
            <div style="width: 500px;margin-top: 46px; text-align: center;float: left;">
                <asp:UpdatePanel ID="ImagePanel" UpdateMode="Conditional" ChildrenAsTriggers="False" runat="server">
                <ContentTemplate>
                    <a id="burnDownChartLink" target="_blank" href="">
                        <img alt="Burndown chart" onerror="this.src='images/noreportavailable.png'" id="burnDownChart" border="0" style="width: 488px;height: 266px" src="images/empty.png">
                    </a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="display: none">
                            <iframe width="0" height="0" visible="false" runat="server" id="reportViewer" enableviewstate="false"></iframe>
                    </div>
                    </ContentTemplate>
                    <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="viewSprintButton" />
                        </Triggers>
                   </asp:UpdatePanel>
                
            </div>
            <div style="clear: both">
           <asp:UpdatePanel ID="WorkItemPanel" UpdateMode="Conditional" ChildrenAsTriggers="False" runat="server">
           <ContentTemplate>
           <table class="WorkItemTable">
           <tr>
               <th class="WorkItemTable" style="background-color: #eeeeee; width: 170px;"><div style="font-weight: bold; width: 170px; padding: 5px;" id="createpb" runat="server">Product Backlog</div>
                    <div id="createpbMenu" class="ContextMenuPanel" style="display: none" runat="server">
                        <UC:CreateProductBacklogMenu ID="CreateProductBacklogMenu" runat="server"></UC:CreateProductBacklogMenu>
                    </div>
                    <ajaxToolkit:DropDownExtender runat="server" ID="DDE"
                        TargetControlID="createpb" 
                        DropDownControlID="createpbMenu" />
               </th>
               <th class="WorkItemTable" style="width:50%;"><b>Not Done</b></td>
               <th class="WorkItemTable" style="width: 158px;"><div style="width: 158px;"><b>In Progress</b></div></td>
               <th class="WorkItemTable" style="width: 158px;"><div style="width: 158px;"><b>Ready For Test</b></div></td>
               <th class="WorkItemTable" style="width:50%;"><b>Done</b></td>
           </tr>
           <asp:Repeater runat="server" ID="productBacklog" EnableViewState="false">
             <ItemTemplate>
                <tr>
                <td class="WorkItemTable" valign="top" style="width: 170px;height: 100%">
                    <UC:ProductBacklogView PB=<%# Container.DataItem %> runat="server"></UC:ProductBacklogView>
                </td>
                <td class="WorkItemTable DropTarget State-NotDone" valign="top" style="width:50%;">
                    <asp:Repeater DataSource=<%#GetStatus(Eval("ID"),"Not Done")%> runat="server">
                    <ItemTemplate>
                         <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                    </ItemTemplate>
                    </asp:Repeater>
                </td>
               <td class="WorkItemTable DropTarget State-InProgress" valign="top" style="width: 158px;">
                    <asp:Repeater ID="Repeater1" DataSource=<%#GetStatus(Eval("ID"),"In Progress")%> runat="server">
                    <ItemTemplate>
                          <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                   </ItemTemplate>
                   </asp:Repeater>
               </td>
                <td class="WorkItemTable DropTarget State-ReadyForTest" valign="top" style="width: 158px;">
                    <asp:Repeater ID="Repeater4" DataSource=<%#GetStatus(Eval("ID"),"Ready For Test")%> runat="server">
                    <ItemTemplate>
                          <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                   </ItemTemplate>
                   </asp:Repeater>
               </td>
               <td class="WorkItemTable DropTarget State-Done" style="width:50%;" valign="top">
                    <asp:Repeater ID="Repeater2" DataSource=<%#GetStatus(Eval("ID"),"Done")%> runat="server">
                    <ItemTemplate>
                         <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                   </ItemTemplate>
                   </asp:Repeater>
               </td>
               </tr>
             </ItemTemplate>
             <AlternatingItemTemplate>
             <tr style="background-color: #F6F6F6;">
                <td class="WorkItemTable" valign="top" style="width: 170px;">
                  <UC:ProductBacklogView ID="ProductBacklogView1" PB=<%# Container.DataItem %> runat="server"></UC:ProductBacklogView>
                </td>
                <td class="WorkItemTable DropTarget State-NotDone" valign="top" style="width:50%;">
                    <asp:Repeater ID="Repeater3" DataSource=<%#GetStatus(Eval("ID"),"Not Done")%> runat="server">
                    <ItemTemplate>
                         <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                    </ItemTemplate>
                    </asp:Repeater>
                </td>
               <td class="WorkItemTable DropTarget State-InProgress" valign="top" style="width: 158px;">
                    <asp:Repeater ID="Repeater1" DataSource=<%#GetStatus(Eval("ID"),"In Progress")%> runat="server">
                    <ItemTemplate>
                          <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                   </ItemTemplate>
                   </asp:Repeater>
               </td>
                <td class="WorkItemTable DropTarget State-ReadyForTest" valign="top" style="width: 158px;">
                    <asp:Repeater ID="Repeater4" DataSource=<%#GetStatus(Eval("ID"),"Ready For Test")%> runat="server">
                    <ItemTemplate>
                          <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                   </ItemTemplate>
                   </asp:Repeater>
               </td>
               <td class="WorkItemTable DropTarget State-Done" style="width:50%;" valign="top">
                    <asp:Repeater ID="Repeater2" DataSource=<%#GetStatus(Eval("ID"),"Done")%> runat="server">
                    <ItemTemplate>
                         <UC:WorkItemView CssClass=<%#GetWorkItemCssClass(Container.DataItem)%> ID="WorkItemView1" SB=<%# Container.DataItem %> runat="server"></UC:WorkItemView>
                   </ItemTemplate>
                   </asp:Repeater>
               </td>
             </AlternatingItemTemplate>
            </asp:Repeater>
            </table>
       </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="viewSprintButton" />
    </Triggers>
    </asp:UpdatePanel>
   </div>
   
    <UC:AssignTo ID="AssignToUC" runat="server" />
    <UC:ImportBugsView ID="ImportBugsView1" runat="server" />
    <UC:CreateTaskView ID="ImportBugsView2" runat="server" />
    <UC:CreateProductBacklogView ID="CreateTaskView1" runat="server" />
    <UC:AddProductBacklogsView ID="AddProductBacklogView1" runat="server" />
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
    <ProgressTemplate>
         <ajaxToolkit:AlwaysVisibleControlExtender ID="avce" runat="server"
                    TargetControlID="progressPopup"
                    VerticalSide="Middle"
                    VerticalOffset="10"
                    HorizontalSide="Center"
                    HorizontalOffset="80"
                    />
         <div id="progressPopup" class="ProgressPopup" runat="server">
            <img alt="Loading" style="vertical-align: middle" src="images/progress.gif" /> Loading..  
         </div>
   </ProgressTemplate>
  </asp:UpdateProgress>
    <input type="hidden" name="SelectedProductBacklogID" id="SelectedProductBacklogID" value="" />
    <iframe width="0" height="0" visible="false" runat="server" id="tfsKeepAliveFrameID" name="tfsKeepAliveFrame"></iframe>
    </form>
</body>
</html>
